//
//  MMerchantMapViewController.m
//  NeusoftHBSJSober
//
//  Created by Apple-21 on 15/11/6.
//  Copyright (c) 2015年 com.neusoftsober. All rights reserved.
//

#import "MMerchantMapViewController.h"

@interface MMerchantMapViewController ()

@property (weak, nonatomic) IBOutlet BMKMapView *mapView;
- (IBAction)backAction:(UIButton *)sender;
@end

@implementation MMerchantMapViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    locaService = [[BMKLocationService alloc]init];
    
    BMKPointAnnotation *pointAnnotion = [[BMKPointAnnotation alloc]init];
    CLLocationCoordinate2D coor = CLLocationCoordinate2DMake([self.model.latitude floatValue], [self.model.longtitude floatValue]);
    pointAnnotion.coordinate = coor;
    pointAnnotion.title = self.model.companyName;
    
    [self.mapView addAnnotation:pointAnnotion];
    [self.mapView setCenterCoordinate:coor animated:YES];
    [self.mapView setMinZoomLevel:14.0f];
    
}
- (void)viewWillAppear:(BOOL)animated {
    
    [self.mapView viewWillAppear];
    
    self.mapView.delegate = self;
}
- (void)viewWillDisappear:(BOOL)animated {
    [self.mapView viewWillDisappear];
    self.mapView.delegate = nil;

}
- (void)mapView:(BMKMapView *)mapView didSelectAnnotationView:(BMKAnnotationView *)view {

    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (void)dealloc{

    if (self.mapView) {
        self.mapView = nil;
    }
}
- (IBAction)backAction:(UIButton *)sender {
    
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end
